package au.com.mason.propertyTracker.controller;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;

import au.com.mason.propertyTracker.form.AddSuburbForm;
import au.com.mason.propertyTracker.service.SuburbService;

@Controller
public class AddSuburb {
	
	private SuburbService suburbService;

	@Autowired
	public AddSuburb(SuburbService suburbService) {
		this.suburbService = suburbService;
	}
	
	@RequestMapping("/SubmitAddSuburb.action")
	public String submitAddSuburb(AddSuburbForm addSuburbForm) {
		suburbService.saveSuburb(addSuburbForm.getSuburb());
		
		return "redirect:DisplayReferenceData.action";
	}

}
